<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<script>
			function $$(id){
				return document.getElementById(id)
			}
			window.onload=function(){
				var cnv=$$("canvas")
				var cxt=cnv.getContext("2d")
				
				var text="面向cv编程[doge]"
				cxt.font="20px bold"
				var textWidth=cxt.measureText(text).width
				var canvasWidth=cnv.width
				var xPosition=canvasWidth/2-textWidth/2
				cxt.fillStyle="palegreen"
				cxt.fillText(text,xPosition,50,160)
			}
		</script>
	</head>
	<body>
		<canvas id="canvas"width="200"height="150" style="border: 1px dashed gray;"></canvas>
	</body>
</html>
